<template>
  <div id="wrapper">
    <div class="box">
      <div class="tools">
        <div title="关闭窗口" @click="closeWindown"  class="btn close"><Icon type="ios-close" /></div>
      </div>
      <div class="top">
        <span>海草</span>
      </div>
      <div class="loginbox">
        <div class="cont">
          <input class="input name" v-model="username" type="text" placeholder="客服账号/手机号" >
          <input class="input pwd" v-model="pwd" type="password" placeholder="密码" >
          <div class="select">
            <Checkbox v-model="adminLogin">管理员登录</Checkbox>
            <Checkbox v-model="mobileLogin">手机登录</Checkbox>
          </div>
          <Button class="loginss" :loading="loading" type="success" long @click="login">登&emsp;录</Button>
        </div>
      </div>
    </div>
    <!-- <Input v-model="username" placeholder="请输入账户" clearable  /><br>
    <Input v-model="pwd" type="password" placeholder="输入密码" clearable  /><br>
    <Button type="success" long @click="login">登录</Button> -->
  </div>
</template>

<script>
  // import test from '../../components/test/test.vue'
  export default {
    name: 'Login',
    data: function () {
      return {
        loading: false,
        username: '',
        pwd: '',
        adminLogin: false,
        mobileLogin: false
      }
    },
    created: function () {

    },
    methods: {
      closeWindown () {
        // this.$electron.shell.openExternal(link)//在外部打开链接
        this.electron.ipcRenderer.send('close_login_window', {
          msg: 'aaaaa'
        })
      },
      login () {
        this.loading = true
        var that = this
        this.$fn.postLogin(this).then(function (data) {
          that.electron.ipcRenderer.send('login_to_main')
        }).catch(function (err) {
          that.loading = false
          that.$Message.error(err.message)
        })
      }
    }
  }
</script>

<style  lang="less" scoped>
  @import "./style.less";

</style>
